#ifndef COMPOSITE_PATTERN_H
#define COMPOSITE_PATTERN_H

#include <string>
#include <list>

using namespace std;

class Employee
{
public:
    Employee(string name, string dept, int sal);
    ~Employee() {}

    void add(Employee* e);
    void remove(Employee* e);
    list<Employee*> getSubordinates();
    string toString();
private:
    string name, dept;
    int salary;
    list<Employee*> subordinates;
};

#endif // COMPOSITE_PATTERN_H

/*
    Employee* CEO = new Employee("John","CEO", 30000);

    Employee* headSales = new Employee("Robert","Head Sales", 20000);

    Employee* headMarketing = new Employee("Michel","Head Marketing", 20000);

    Employee* clerk1 = new Employee("Laura","Marketing", 10000);
    Employee* clerk2 = new Employee("Bob","Marketing", 10000);

    Employee* salesExecutive1 = new Employee("Richard","Sales", 10000);
    Employee* salesExecutive2 = new Employee("Rob","Sales", 10000);

    CEO->add(headSales);
    CEO->add(headMarketing);

    headSales->add(salesExecutive1);
    headSales->add(salesExecutive2);

    headMarketing->add(clerk1);
    headMarketing->add(clerk2);

    cout << CEO->toString() << endl;
    list<Employee*> ceo_sub = CEO->getSubordinates();
    list<Employee*>::iterator it = ceo_sub.begin();
    for(; it != ceo_sub.end(); it++)
    {
        cout << (*it)->toString() << endl;
        list<Employee*> ceo_sub_sub = (*it)->getSubordinates();
        list<Employee*>::iterator it_inner = ceo_sub_sub.begin();
        for(; it_inner != ceo_sub_sub.end(); it_inner++)
        {
            cout << (*it_inner)->toString() << endl;
        }
    }
    */
